package com.wash.shoes.domain.dy.request;

import com.wash.shoes.entity.ShopGoodsPo;
import com.wash.shoes.service.OrderGoodService;
import com.wash.shoes.service.OrderService;
import com.wash.shoes.service.ShopGoodsService;
import lombok.extern.log4j.Log4j2;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

/**
 * @author lijianguo
 * @Date 29/03/2025 08:28
 * 请输入类的简介
 **/
@Log4j2
@Component
public class DyTestComponent {

    @Resource
    DyGoodsRequest dyGoodsRequest;

    @Resource
    DyOrderRequest dyOrderRequest;

    @Resource
    private RedisTemplate redisTemplate;

    @Resource
    private RestTemplate restTemplate;

    @Resource
    OrderGoodService orderGoodService;

    @Resource
    OrderService orderService;

    @Resource
    DyRefundRequest refundRequest;

    @Resource
    DyBookRequest dyBookRequest;

    @Resource
    ShopGoodsService shopGoodsService;

    @Resource
    DyServiceUpdateRequest serviceUpdateRequest;

//    @PostConstruct
    public void init() {
        log.info("DyTestComponent init...");

        try {
            runCatch();
        } catch (Exception e) {
            log.error(e);
        }
    }


    private void runCatch() {

        // 202503253977322108
        // 202409280873368569
        //

         String ID = "202503253977322108";
         ShopGoodsPo shopGoodsPo = shopGoodsService.getById(ID);
         // 上传商品
        dyGoodsRequest.saveOrUpdateProduct(shopGoodsPo);

        // 下架商品
        // postOperate(ID, 2);

//        String result = dyGoodsRequest.getGoodsType();
//
//        List<ProductAttrs> dataList = dyGoodsRequest.getProductTemplate(DyConstant.CATEGORY_ID, DyConstant.PRODUCT_TYPE);
//
//        Object object = refundRequest.queryRefund(orderPo);

//        dyGoodsRequest.getGoodsDraft(DyConstant.ACCOUNT_ID,"202409281493654242");

//        OrderPo orderPo = orderService.getByOrderNo("D20250401sl0104223");
//
//        dyBookRequest.queryBook(orderPo);
//        dyOrderRequest.queryOrder(orderPo);

        // dyBookRequest.bookResultCallback(orderPo);

//
//        dyBookRequest.userCancelBookPost(orderPo);


//        dyBookRequest.merchantCancelBookPost(orderPo);
//
//         JSONObject jsonObject = refundRequest.refund(orderPo);

        //dyBookRequest.createBookPost(orderPo);

//        serviceUpdateRequest.updateFullFill(orderPo, 4,"JDX038029243532", "18382496398");

        log.info("====");
    }

}
